package com.peng.immodule.im;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/**
 * Created by Mr.Q on 2018/3/6.
 * 描述
 */

public class IMGroupManager {
    EMAGroupManager emaObject;
    private static String TAG = "group";
    List<EMGroupChangeListener> groupChangeListeners;
    EMAGroupManagerListener listenerImpl = new EMAGroupManagerListener() {
        public void onReceiveInviteFromGroup(String var1, String var2, String var3) {
            List var4 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var5 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var5.hasNext()) {
                        EMGroupChangeListener var6 = (EMGroupChangeListener)var5.next();
                        var6.onInvitationReceived(var1, "", var2, var3);
                    }
                } catch (Exception var8) {
                    var8.printStackTrace();
                }

            }
        }

        public void onReceiveInviteAcceptionFromGroup(EMAGroup var1, String var2) {
            List var3 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var4 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var4.hasNext()) {
                        EMGroupChangeListener var5 = (EMGroupChangeListener)var4.next();
                        var5.onInvitationAccepted(var1.groupId(), var2, "");
                    }
                } catch (Exception var7) {
                    var7.printStackTrace();
                }

            }
        }

        public void onReceiveInviteDeclineFromGroup(EMAGroup var1, String var2, String var3) {
            List var4 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var5 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var5.hasNext()) {
                        EMGroupChangeListener var6 = (EMGroupChangeListener)var5.next();
                        var6.onInvitationDeclined(var1.groupId(), var2, "");
                    }
                } catch (Exception var8) {
                    var8.printStackTrace();
                }

            }
        }

        public void onAutoAcceptInvitationFromGroup(EMAGroup var1, String var2, String var3) {
            List var4 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var5 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var5.hasNext()) {
                        EMGroupChangeListener var6 = (EMGroupChangeListener)var5.next();
                        var6.onAutoAcceptInvitationFromGroup(var1.groupId(), var2, var3);
                    }
                } catch (Exception var8) {
                    var8.printStackTrace();
                }

            }
        }

        public void onLeaveGroup(EMAGroup var1, int var2) {
            EMClient.getInstance().chatManager().caches.remove(var1.groupId());
            List var3 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var4 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var4.hasNext()) {
                        EMGroupChangeListener var5 = (EMGroupChangeListener)var4.next();
                        if(var2 == EMGroupLeaveReason.BE_KICKED.ordinal()) {
                            var5.onUserRemoved(var1.groupId(), var1.groupSubject());
                        } else {
                            var5.onGroupDestroyed(var1.groupId(), var1.groupSubject());
                        }
                    }
                } catch (Exception var7) {
                    var7.printStackTrace();
                }

            }
        }

        public void onReceiveJoinGroupApplication(EMAGroup var1, String var2, String var3) {
            List var4 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var5 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var5.hasNext()) {
                        EMGroupChangeListener var6 = (EMGroupChangeListener)var5.next();
                        var6.onRequestToJoinReceived(var1.groupId(), var1.groupSubject(), var2, var3);
                    }
                } catch (Exception var8) {
                    var8.printStackTrace();
                }

            }
        }

        public void onReceiveAcceptionFromGroup(EMAGroup var1) {
            List var2 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var3 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var3.hasNext()) {
                        EMGroupChangeListener var4 = (EMGroupChangeListener)var3.next();
                        var4.onRequestToJoinAccepted(var1.groupId(), var1.groupSubject(), var1.getOwner());
                    }
                } catch (Exception var6) {
                    var6.printStackTrace();
                }

            }
        }

        public void onReceiveRejectionFromGroup(String var1, String var2) {
            EMGroup var3 = EMGroupManager.this.getGroup(var1);
            String var4 = var3 == null?"":var3.groupSubject();
            String var5 = var3 == null?"":var3.getOwner();
            List var6 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var7 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var7.hasNext()) {
                        EMGroupChangeListener var8 = (EMGroupChangeListener)var7.next();
                        var8.onRequestToJoinDeclined(var1, var4, var5, var2);
                    }
                } catch (Exception var10) {
                    var10.printStackTrace();
                }

            }
        }

        public void onUpdateMyGroupList(List<EMAGroup> var1) {
        }

        public void onAddMutesFromGroup(EMAGroup var1, List<String> var2, long var3) {
            List var5 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var6 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var6.hasNext()) {
                        EMGroupChangeListener var7 = (EMGroupChangeListener)var6.next();
                        var7.onMuteListAdded(var1.groupId(), var2, var3);
                    }
                } catch (Exception var9) {
                    var9.printStackTrace();
                }

            }
        }

        public void onRemoveMutesFromGroup(EMAGroup var1, List<String> var2) {
            List var3 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var4 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var4.hasNext()) {
                        EMGroupChangeListener var5 = (EMGroupChangeListener)var4.next();
                        var5.onMuteListRemoved(var1.groupId(), var2);
                    }
                } catch (Exception var7) {
                    var7.printStackTrace();
                }

            }
        }

        public void onAddAdminFromGroup(EMAGroup var1, String var2) {
            List var3 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var4 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var4.hasNext()) {
                        EMGroupChangeListener var5 = (EMGroupChangeListener)var4.next();
                        var5.onAdminAdded(var1.groupId(), var2);
                    }
                } catch (Exception var7) {
                    var7.printStackTrace();
                }

            }
        }

        public void onRemoveAdminFromGroup(EMAGroup var1, String var2) {
            List var3 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var4 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var4.hasNext()) {
                        EMGroupChangeListener var5 = (EMGroupChangeListener)var4.next();
                        var5.onAdminRemoved(var1.groupId(), var2);
                    }
                } catch (Exception var7) {
                    var7.printStackTrace();
                }

            }
        }

        public void onAssignOwnerFromGroup(EMAGroup var1, String var2, String var3) {
            List var4 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var5 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var5.hasNext()) {
                        EMGroupChangeListener var6 = (EMGroupChangeListener)var5.next();
                        var6.onOwnerChanged(var1.groupId(), var2, var3);
                    }
                } catch (Exception var8) {
                    var8.printStackTrace();
                }

            }
        }

        public void onMemberJoined(EMAGroup var1, String var2) {
            List var3 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var4 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var4.hasNext()) {
                        EMGroupChangeListener var5 = (EMGroupChangeListener)var4.next();
                        var5.onMemberJoined(var1.groupId(), var2);
                    }
                } catch (Exception var7) {
                    var7.printStackTrace();
                }

            }
        }

        public void onMemberExited(EMAGroup var1, String var2) {
            List var3 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var4 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var4.hasNext()) {
                        EMGroupChangeListener var5 = (EMGroupChangeListener)var4.next();
                        var5.onMemberExited(var1.groupId(), var2);
                    }
                } catch (Exception var7) {
                    var7.printStackTrace();
                }

            }
        }

        public void onAnnouncementChanged(EMAGroup var1, String var2) {
            List var3 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var4 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var4.hasNext()) {
                        EMGroupChangeListener var5 = (EMGroupChangeListener)var4.next();
                        var5.onAnnouncementChanged(var1.groupId(), var2);
                    }
                } catch (Exception var7) {
                    var7.printStackTrace();
                }

            }
        }

        public void onUploadShareFileFromGroup(EMAGroup var1, EMAMucShareFile var2) {
            List var3 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var4 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var4.hasNext()) {
                        EMGroupChangeListener var5 = (EMGroupChangeListener)var4.next();
                        var5.onSharedFileAdded(var1.groupId(), new EMMucSharedFile(var2));
                    }
                } catch (Exception var7) {
                    var7.printStackTrace();
                }

            }
        }

        public void onDeleteShareFileFromGroup(EMAGroup var1, String var2) {
            List var3 = EMGroupManager.this.groupChangeListeners;
            synchronized(EMGroupManager.this.groupChangeListeners) {
                try {
                    Iterator var4 = EMGroupManager.this.groupChangeListeners.iterator();

                    while(var4.hasNext()) {
                        EMGroupChangeListener var5 = (EMGroupChangeListener)var4.next();
                        var5.onSharedFileDeleted(var1.groupId(), var2);
                    }
                } catch (Exception var7) {
                    var7.printStackTrace();
                }

            }
        }
    };
    EMClient mClient;

    EMGroupManager(EMClient var1, EMAGroupManager var2) {
        this.emaObject = var2;
        this.mClient = var1;
        this.groupChangeListeners = Collections.synchronizedList(new ArrayList());
        this.emaObject.addListener(this.listenerImpl);
    }

    public List<EMGroup> getAllGroups() {
        EMAError var1 = new EMAError();
        List var2 = this.emaObject.allMyGroups(var1);
        ArrayList var3 = new ArrayList();
        Iterator var4 = var2.iterator();

        while(var4.hasNext()) {
            EMAGroup var5 = (EMAGroup)var4.next();
            var3.add(new EMGroup(var5));
        }

        return Collections.unmodifiableList(var3);
    }

    public EMGroup getGroup(String var1) {
        EMAError var2 = new EMAError();
        List var3 = this.emaObject.allMyGroups(var2);
        Iterator var4 = var3.iterator();

        EMAGroup var5;
        do {
            if(!var4.hasNext()) {
                return null;
            }

            var5 = (EMAGroup)var4.next();
        } while(!var5.groupId().equals(var1));

        return new EMGroup(var5);
    }

    public EMGroup createGroup(String var1, String var2, String[] var3, String var4, EMGroupOptions var5) throws HyphenateException {
        byte var6 = 0;
        switch(null.$SwitchMap$com$hyphenate$chat$EMGroupManager$EMGroupStyle[var5.style.ordinal()]) {
            case 1:
                var6 = 0;
                break;
            case 2:
                var6 = 1;
                break;
            case 3:
                var6 = 2;
                break;
            case 4:
                var6 = 3;
        }

        return this.createGroup(var6, var1, var2, var3, var5.maxUsers, var4, var5.inviteNeedConfirm, var5.extField);
    }

    public void asyncCreateGroup(final String var1, final String var2, final String[] var3, final String var4, final EMGroupOptions var5, final EMValueCallBack<EMGroup> var6) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroup var1x = EMGroupManager.this.createGroup(var1, var2, var3, var4, var5);
                    var6.onSuccess(var1x);
                } catch (HyphenateException var2x) {
                    var6.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    private EMGroup createGroup(int var1, String var2, String var3, String[] var4, int var5, String var6, boolean var7, String var8) throws HyphenateException {
        EMAGroupSetting var9 = new EMAGroupSetting(var1, var5, var7, var8);
        ArrayList var10 = new ArrayList();
        Collections.addAll(var10, var4);
        EMAError var11 = new EMAError();
        EMAGroup var12 = this.emaObject.createGroup(var2, var3, var6, var9, var10, var7, var11);
        this.handleError(var11);
        return new EMGroup(var12);
    }

    public synchronized void loadAllGroups() {
        this.emaObject.loadAllMyGroupsFromDB();
    }

    public void destroyGroup(String var1) throws HyphenateException {
        EMAError var2 = new EMAError();
        this.emaObject.destroyGroup(var1, var2);
        EMClient.getInstance().chatManager().caches.remove(var1);
        this.handleError(var2);
    }

    public void asyncDestroyGroup(final String var1, final EMCallBack var2) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.destroyGroup(var1);
                    var2.onSuccess();
                } catch (HyphenateException var2x) {
                    var2.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void addUsersToGroup(String var1, String[] var2) throws HyphenateException {
        EMAError var3 = new EMAError();
        ArrayList var4 = new ArrayList();
        Collections.addAll(var4, var2);
        this.emaObject.addGroupMembers(var1, var4, "welcome", var3);
        this.handleError(var3);
    }

    public void asyncAddUsersToGroup(final String var1, final String[] var2, final EMCallBack var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.addUsersToGroup(var1, var2);
                    var3.onSuccess();
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void removeUserFromGroup(String var1, String var2) throws HyphenateException {
        ArrayList var3 = new ArrayList();
        EMAError var4 = new EMAError();
        var3.add(var2);
        this.emaObject.removeGroupMembers(var1, var3, var4);
        this.handleError(var4);
        this.emaObject.fetchGroupSpecification(var1, var4, true);
        this.handleError(var4);
    }

    public void asyncRemoveUserFromGroup(final String var1, final String var2, final EMCallBack var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.removeUserFromGroup(var1, var2);
                    var3.onSuccess();
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void leaveGroup(String var1) throws HyphenateException {
        EMAError var2 = new EMAError();
        this.emaObject.leaveGroup(var1, var2);
        EMClient.getInstance().chatManager().caches.remove(var1);
        this.handleError(var2);
    }

    public void asyncLeaveGroup(final String var1, final EMCallBack var2) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.leaveGroup(var1);
                    var2.onSuccess();
                } catch (HyphenateException var2x) {
                    var2.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public EMGroup getGroupFromServer(String var1) throws HyphenateException {
        if(var1 != null && !var1.isEmpty()) {
            EMAError var2 = new EMAError();
            EMAGroup var3 = this.emaObject.fetchGroupSpecification(var1, var2, false);
            this.handleError(var2);
            return new EMGroup(var3);
        } else {
            throw new HyphenateException(600, "group id is null or empty");
        }
    }

    public EMGroup getGroupFromServer(String var1, boolean var2) throws HyphenateException {
        if(var1 != null && !var1.isEmpty()) {
            EMAError var3 = new EMAError();
            EMAGroup var4 = this.emaObject.fetchGroupSpecification(var1, var3, var2);
            this.handleError(var3);
            return new EMGroup(var4);
        } else {
            throw new HyphenateException(600, "group id is null or empty");
        }
    }

    public void asyncGetGroupFromServer(final String var1, final EMValueCallBack<EMGroup> var2) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroup var1x = EMGroupManager.this.getGroupFromServer(var1);
                    var2.onSuccess(var1x);
                } catch (HyphenateException var2x) {
                    var2.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    synchronized List<EMGroup> getGroupsFromServer() throws HyphenateException {
        EMAError var1 = new EMAError();
        List var2 = this.emaObject.fetchAllMyGroups(var1);
        this.handleError(var1);
        ArrayList var3 = new ArrayList();
        Iterator var4 = var2.iterator();

        while(var4.hasNext()) {
            EMAGroup var5 = (EMAGroup)var4.next();
            var3.add(new EMGroup(var5));
        }

        return var3;
    }

    synchronized List<EMGroup> getGroupsFromServer(int var1, int var2) throws HyphenateException {
        EMAError var3 = new EMAError();
        List var4 = this.emaObject.fetchAllMyGroupsWithPage(var1, var2, var3);
        this.handleError(var3);
        ArrayList var5 = new ArrayList();
        Iterator var6 = var4.iterator();

        while(var6.hasNext()) {
            EMAGroup var7 = (EMAGroup)var6.next();
            var5.add(new EMGroup(var7));
        }

        return var5;
    }

    void asyncGetGroupsFromServer(final EMValueCallBack<List<EMGroup>> var1) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    List var1x = EMGroupManager.this.getGroupsFromServer();
                    var1.onSuccess(var1x);
                } catch (HyphenateException var2) {
                    var1.onError(var2.getErrorCode(), var2.getDescription());
                }

            }
        });
    }

    public synchronized List<EMGroup> getJoinedGroupsFromServer() throws HyphenateException {
        return this.getGroupsFromServer();
    }

    public synchronized List<EMGroup> getJoinedGroupsFromServer(int var1, int var2) throws HyphenateException {
        return this.getGroupsFromServer(var1, var2);
    }

    public void asyncGetJoinedGroupsFromServer(final EMValueCallBack<List<EMGroup>> var1) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    List var1x = EMGroupManager.this.getJoinedGroupsFromServer();
                    var1.onSuccess(var1x);
                } catch (HyphenateException var2) {
                    var1.onError(var2.getErrorCode(), var2.getDescription());
                }

            }
        });
    }

    public void asyncGetJoinedGroupsFromServer(final int var1, final int var2, final EMValueCallBack<List<EMGroup>> var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    List var1x = EMGroupManager.this.getJoinedGroupsFromServer(var1, var2);
                    var3.onSuccess(var1x);
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public EMCursorResult<EMGroupInfo> getPublicGroupsFromServer(int var1, String var2) throws HyphenateException {
        EMAError var3 = new EMAError();
        EMCursorResult var4 = this.emaObject.fetchPublicGroupsWithCursor(var2, var1, var3);
        this.handleError(var3);
        return var4;
    }

    public void asyncGetPublicGroupsFromServer(final int var1, final String var2, final EMValueCallBack<EMCursorResult<EMGroupInfo>> var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMCursorResult var1x = EMGroupManager.this.getPublicGroupsFromServer(var1, var2);
                    var3.onSuccess(var1x);
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void joinGroup(String var1) throws HyphenateException {
        EMAError var2 = new EMAError();
        EMAGroup var3 = this.emaObject.fetchGroupSpecification(var1, var2, false);
        this.handleError(var2);
        if(var3.groupSetting() == null) {
            throw new HyphenateException();
        } else if(var3.groupSetting().style() == 3) {
            this.emaObject.joinPublicGroup(var1, var2);
            this.handleError(var2);
        } else if(var3.groupSetting().style() == 2) {
            this.emaObject.applyJoinPublicGroup(var1, this.mClient.getCurrentUser(), "hello", var2);
            this.handleError(var2);
        }
    }

    public void asyncJoinGroup(final String var1, final EMCallBack var2) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.joinGroup(var1);
                    var2.onSuccess();
                } catch (HyphenateException var2x) {
                    var2.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void changeGroupName(String var1, String var2) throws HyphenateException {
        EMAError var3 = new EMAError();
        this.emaObject.changeGroupSubject(var1, var2, var3);
        this.handleError(var3);
    }

    public void asyncChangeGroupName(final String var1, final String var2, final EMCallBack var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.changeGroupName(var1, var2);
                    var3.onSuccess();
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void changeGroupDescription(String var1, String var2) throws HyphenateException {
        EMAError var3 = new EMAError();
        this.emaObject.changeGroupDescription(var1, var2, var3);
        this.handleError(var3);
    }

    public void asyncChangeGroupDescription(final String var1, final String var2, final EMCallBack var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.changeGroupDescription(var1, var2);
                    var3.onSuccess();
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public EMGroup acceptInvitation(String var1, String var2) throws HyphenateException {
        EMAError var3 = new EMAError();
        EMAGroup var4 = this.emaObject.acceptInvitationFromGroup(var1, var2 == null?"":var2, var3);
        this.handleError(var3);
        return new EMGroup(var4);
    }

    public void asyncAcceptInvitation(final String var1, final String var2, final EMValueCallBack<EMGroup> var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroup var1x = EMGroupManager.this.acceptInvitation(var1, var2);
                    var3.onSuccess(var1x);
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void declineInvitation(String var1, String var2, String var3) throws HyphenateException {
        EMAError var4 = new EMAError();
        this.emaObject.declineInvitationFromGroup(var1, var2 == null?"":var2, var3 == null?"":var3, var4);
        this.handleError(var4);
    }

    public void asyncDeclineInvitation(final String var1, final String var2, final String var3, final EMCallBack var4) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.declineInvitation(var1, var2, var3);
                    var4.onSuccess();
                } catch (HyphenateException var2x) {
                    var4.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void acceptApplication(String var1, String var2) throws HyphenateException {
        EMAError var3 = new EMAError();
        this.emaObject.acceptJoinGroupApplication(var2, var1, var3);
        this.handleError(var3);
    }

    public void asyncAcceptApplication(final String var1, final String var2, final EMCallBack var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.acceptApplication(var1, var2);
                    var3.onSuccess();
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void declineApplication(String var1, String var2, String var3) throws HyphenateException {
        EMAError var4 = new EMAError();
        this.emaObject.declineJoinGroupApplication(var2, var1, var3, var4);
        this.handleError(var4);
    }

    public void asyncDeclineApplication(final String var1, final String var2, final String var3, final EMCallBack var4) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.declineApplication(var1, var2, var3);
                    var4.onSuccess();
                } catch (HyphenateException var2x) {
                    var4.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void inviteUser(String var1, String[] var2, String var3) throws HyphenateException {
        EMAError var4 = new EMAError();
        ArrayList var5 = new ArrayList();
        Collections.addAll(var5, var2);
        this.emaObject.addGroupMembers(var1, var5, var3, var4);
        this.handleError(var4);
    }

    public void asyncInviteUser(final String var1, final String[] var2, final String var3, final EMCallBack var4) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.inviteUser(var1, var2, var3);
                    var4.onSuccess();
                } catch (HyphenateException var2x) {
                    var4.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void applyJoinToGroup(String var1, String var2) throws HyphenateException {
        String var3 = this.mClient.getCurrentUser();
        EMAError var4 = new EMAError();
        this.emaObject.applyJoinPublicGroup(var1, var3, var2, var4);
        this.handleError(var4);
    }

    public void asyncApplyJoinToGroup(final String var1, final String var2, final EMCallBack var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.applyJoinToGroup(var1, var2);
                    var3.onSuccess();
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void blockGroupMessage(String var1) throws HyphenateException {
        EMAError var2 = new EMAError();
        this.emaObject.blockGroupMessage(var1, var2);
        this.handleError(var2);
    }

    public void asyncBlockGroupMessage(final String var1, final EMCallBack var2) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.blockGroupMessage(var1);
                    var2.onSuccess();
                } catch (HyphenateException var2x) {
                    var2.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void unblockGroupMessage(String var1) throws HyphenateException {
        EMLog.d(TAG, "try to unblock group msg:" + var1);
        EMAError var2 = new EMAError();
        this.emaObject.unblockGroupMessage(var1, var2);
        this.handleError(var2);
    }

    public void asyncUnblockGroupMessage(final String var1, final EMCallBack var2) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.unblockGroupMessage(var1);
                    var2.onSuccess();
                } catch (HyphenateException var2x) {
                    var2.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void blockUser(String var1, String var2) throws HyphenateException {
        EMLog.d(TAG, "block user for groupid:" + var1 + " username:" + var2);
        EMAError var3 = new EMAError();
        String var4 = "";
        ArrayList var5 = new ArrayList();
        var5.add(var2);
        this.emaObject.blockGroupMembers(var1, var5, var3, var4);
        this.handleError(var3);
    }

    public void asyncBlockUser(final String var1, final String var2, final EMCallBack var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.blockUser(var1, var2);
                    var3.onSuccess();
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void unblockUser(String var1, String var2) throws HyphenateException {
        EMLog.d(TAG, "unblock user groupid:" + var1 + " username:" + var2);
        EMAError var3 = new EMAError();
        ArrayList var4 = new ArrayList();
        var4.add(var2);
        this.emaObject.unblockGroupMembers(var1, var4, var3);
        this.handleError(var3);
    }

    public void asyncUnblockUser(final String var1, final String var2, final EMCallBack var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.unblockUser(var1, var2);
                    var3.onSuccess();
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public List<String> getBlockedUsers(String var1) throws HyphenateException {
        return this.getBlockedUsers(var1, 0, 200);
    }

    public List<String> getBlockedUsers(String var1, int var2, int var3) throws HyphenateException {
        EMLog.d(TAG, "get blocked users of the group: " + var1);
        EMAError var4 = new EMAError();
        List var5 = this.emaObject.fetchGroupBlackList(var1, var2, var3, var4);
        this.handleError(var4);
        return var5;
    }

    public void asyncGetBlockedUsers(String var1, EMValueCallBack<List<String>> var2) {
        this.asyncGetBlockedUsers(var1, 0, 200, var2);
    }

    public void asyncGetBlockedUsers(final String var1, final int var2, final int var3, final EMValueCallBack<List<String>> var4) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    List var1x = EMGroupManager.this.getBlockedUsers(var1, var2, var3);
                    var4.onSuccess(var1x);
                } catch (HyphenateException var2x) {
                    var4.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void addGroupChangeListener(EMGroupChangeListener var1) {
        EMLog.d(TAG, "add group change listener:" + var1.getClass().getName());
        if(!this.groupChangeListeners.contains(var1)) {
            this.groupChangeListeners.add(var1);
        }

    }

    public void removeGroupChangeListener(EMGroupChangeListener var1) {
        EMLog.d(TAG, "remove group change listener:" + var1.getClass().getName());
        this.groupChangeListeners.remove(var1);
    }

    public EMCursorResult<String> fetchGroupMembers(String var1, String var2, int var3) throws HyphenateException {
        EMAError var4 = new EMAError();
        EMCursorResult var5 = this.emaObject.fetchGroupMembers(var1, var2, var3, var4);
        this.handleError(var4);
        return var5;
    }

    public void asyncFetchGroupMembers(final String var1, final String var2, final int var3, final EMValueCallBack<EMCursorResult<String>> var4) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMCursorResult var1x = EMGroupManager.this.fetchGroupMembers(var1, var2, var3);
                    var4.onSuccess(var1x);
                } catch (HyphenateException var2x) {
                    var4.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public EMGroup changeOwner(String var1, String var2) throws HyphenateException {
        EMAError var3 = new EMAError();
        EMAGroup var4 = this.emaObject.transferGroupOwner(var1, var2, var3);
        this.handleError(var3);
        return new EMGroup(var4);
    }

    public void asyncChangeOwner(final String var1, final String var2, final EMValueCallBack<EMGroup> var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroup var1x = EMGroupManager.this.changeOwner(var1, var2);
                    var3.onSuccess(var1x);
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public EMGroup addGroupAdmin(String var1, String var2) throws HyphenateException {
        EMAError var3 = new EMAError();
        EMAGroup var4 = this.emaObject.addGroupAdmin(var1, var2, var3);
        this.handleError(var3);
        return new EMGroup(var4);
    }

    public void asyncAddGroupAdmin(final String var1, final String var2, final EMValueCallBack<EMGroup> var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    var3.onSuccess(EMGroupManager.this.addGroupAdmin(var1, var2));
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public EMGroup removeGroupAdmin(String var1, String var2) throws HyphenateException {
        EMAError var3 = new EMAError();
        EMAGroup var4 = this.emaObject.removeGroupAdmin(var1, var2, var3);
        this.handleError(var3);
        return new EMGroup(var4);
    }

    public void asyncRemoveGroupAdmin(final String var1, final String var2, final EMValueCallBack<EMGroup> var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    var3.onSuccess(EMGroupManager.this.removeGroupAdmin(var1, var2));
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public EMGroup muteGroupMembers(String var1, List<String> var2, long var3) throws HyphenateException {
        EMAError var5 = new EMAError();
        EMAGroup var6 = this.emaObject.muteGroupMembers(var1, var2, var3, var5);
        this.handleError(var5);
        return new EMGroup(var6);
    }

    public void aysncMuteGroupMembers(final String var1, final List<String> var2, final long var3, final EMValueCallBack<EMGroup> var5) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    var5.onSuccess(EMGroupManager.this.muteGroupMembers(var1, var2, var3));
                } catch (HyphenateException var2x) {
                    var5.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public EMGroup unMuteGroupMembers(String var1, List<String> var2) throws HyphenateException {
        EMAError var3 = new EMAError();
        EMAGroup var4 = this.emaObject.unMuteGroupMembers(var1, var2, var3);
        this.handleError(var3);
        return new EMGroup(var4);
    }

    public void asyncUnMuteGroupMembers(final String var1, final List<String> var2, final EMValueCallBack<EMGroup> var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    var3.onSuccess(EMGroupManager.this.unMuteGroupMembers(var1, var2));
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public Map<String, Long> fetchGroupMuteList(String var1, int var2, int var3) throws HyphenateException {
        EMAError var4 = new EMAError();
        Map var5 = this.emaObject.fetchGroupMutes(var1, var2, var3, var4);
        this.handleError(var4);
        return var5;
    }

    public void asyncFetchGroupMuteList(final String var1, final int var2, final int var3, final EMValueCallBack<Map<String, Long>> var4) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    var4.onSuccess(EMGroupManager.this.fetchGroupMuteList(var1, var2, var3));
                } catch (HyphenateException var2x) {
                    var4.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public List<String> fetchGroupBlackList(String var1, int var2, int var3) throws HyphenateException {
        EMAError var4 = new EMAError();
        List var5 = this.emaObject.fetchGroupBlackList(var1, var2, var3, var4);
        this.handleError(var4);
        return var5;
    }

    public void asyncFetchGroupBlackList(final String var1, final int var2, final int var3, final EMValueCallBack<List<String>> var4) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    var4.onSuccess(EMGroupManager.this.fetchGroupBlackList(var1, var2, var3));
                } catch (HyphenateException var2x) {
                    var4.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void updateGroupAnnouncement(String var1, String var2) throws HyphenateException {
        EMAError var3 = new EMAError();
        this.emaObject.updateGroupAnnouncement(var1, var2, var3);
        this.handleError(var3);
    }

    public void asyncUpdateGroupAnnouncement(final String var1, final String var2, final EMCallBack var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.updateGroupAnnouncement(var1, var2);
                    var3.onSuccess();
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public String fetchGroupAnnouncement(String var1) throws HyphenateException {
        EMAError var2 = new EMAError();
        String var3 = this.emaObject.fetchGroupAnnouncement(var1, var2);
        this.handleError(var2);
        return var3;
    }

    public void asyncFetchGroupAnnouncement(final String var1, final EMValueCallBack<String> var2) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    var2.onSuccess(EMGroupManager.this.fetchGroupAnnouncement(var1));
                } catch (HyphenateException var2x) {
                    var2.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public EMMucSharedFile uploadGroupSharedFile(String var1, String var2, EMCallBack var3) throws HyphenateException {
        EMAError var4 = new EMAError();
        EMACallback var5 = new EMACallback(var3);
        EMAMucShareFile var6 = this.emaObject.uploadGroupShareFile(var1, var2, var5, var4);
        this.handleError(var4);
        var3.onSuccess();
        return new EMMucSharedFile(var6);
    }

    public void asyncUploadGroupSharedFile(final String var1, final String var2, final EMCallBack var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMMucSharedFile var1x = EMGroupManager.this.uploadGroupSharedFile(var1, var2, var3);
                    var3.onSuccess();
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public List<EMMucSharedFile> fetchGroupSharedFileList(String var1, int var2, int var3) throws HyphenateException {
        EMAError var4 = new EMAError();
        List var5 = this.emaObject.fetchGroupShareFiles(var1, var2, var3, var4);
        this.handleError(var4);
        ArrayList var6 = new ArrayList();
        Iterator var7 = var5.iterator();

        while(var7.hasNext()) {
            EMAMucShareFile var8 = (EMAMucShareFile)var7.next();
            var6.add(new EMMucSharedFile(var8));
        }

        return var6;
    }

    public void asyncFetchGroupSharedFileList(final String var1, final int var2, final int var3, final EMValueCallBack<List<EMMucSharedFile>> var4) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    var4.onSuccess(EMGroupManager.this.fetchGroupSharedFileList(var1, var2, var3));
                } catch (HyphenateException var2x) {
                    var4.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void deleteGroupSharedFile(String var1, String var2) throws HyphenateException {
        EMAError var3 = new EMAError();
        this.emaObject.deleteGroupShareFile(var1, var2, var3);
        this.handleError(var3);
    }

    public void asyncDeleteGroupSharedFile(final String var1, final String var2, final EMCallBack var3) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.deleteGroupSharedFile(var1, var2);
                    var3.onSuccess();
                } catch (HyphenateException var2x) {
                    var3.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public void downloadGroupSharedFile(String var1, String var2, String var3, EMCallBack var4) throws HyphenateException {
        EMAError var5 = new EMAError();
        EMACallback var6 = new EMACallback(var4);
        this.emaObject.downloadGroupShareFile(var1, var2, var3, var6, var5);
        this.handleError(var5);
    }

    public void asyncDownloadGroupSharedFile(final String var1, final String var2, final String var3, final EMCallBack var4) {
        EMClient.getInstance().execute(new Runnable() {
            public void run() {
                try {
                    EMGroupManager.this.downloadGroupSharedFile(var1, var2, var3, var4);
                    var4.onSuccess();
                } catch (HyphenateException var2x) {
                    var4.onError(var2x.getErrorCode(), var2x.getDescription());
                }

            }
        });
    }

    public EMGroup updateGroupExtension(String var1, String var2) throws HyphenateException {
        EMAError var3 = new EMAError();
        EMAGroup var4 = this.emaObject.updateGroupExtension(var1, var2, var3);
        this.handleError(var3);
        return new EMGroup(var4);
    }

    void onLogout() {
    }

    private void handleError(EMAError var1) throws HyphenateException {
        if(var1.errCode() != 0) {
            throw new HyphenateException(var1);
        }
    }

    public static enum EMGroupStyle {
        EMGroupStylePrivateOnlyOwnerInvite,
        EMGroupStylePrivateMemberCanInvite,
        EMGroupStylePublicJoinNeedApproval,
        EMGroupStylePublicOpenJoin;

        private EMGroupStyle() {
        }
    }
}
